package com.gx.smart.building.ui.repair.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.recyclerview.widget.RecyclerView;

import com.gx.smart.base.BaseAdapter;
import com.gx.smart.building.R;
import com.gx.smart.building.databinding.ItemRepairAssetsDevicesLayoutBinding;
import com.huishi.gx.ib.grpc.lib.ib.asset.asset.v1.AssetDto;

/**
 * @author: xiaosy
 * 时间: 2022/4/13
 * @Description: java类作用描述
 * @Version: 1.0
 **/
public class AssetsDeviceAdapter extends BaseAdapter<AssetDto, AssetsDeviceAdapter.ViewHolder> {
    public AssetsDeviceAdapter(Context context) {
        super(context);
    }

    @Override
    protected int onBindLayout() {
        return R.layout.item_repair_assets_devices_layout;
    }

    @Override
    protected ViewHolder onCreateHolder(View view) {
        ItemRepairAssetsDevicesLayoutBinding binding = ItemRepairAssetsDevicesLayoutBinding.inflate(LayoutInflater.from(mContext),
                (ViewGroup) view, false);
        return new ViewHolder(binding);
    }

    @Override
    protected void onBindData(ViewHolder holder, AssetDto item, int position) {
        holder.binding.assetName.setText(item.getAssetName());
    }

    protected static class ViewHolder extends RecyclerView.ViewHolder {
        private final ItemRepairAssetsDevicesLayoutBinding binding;

        public ViewHolder(ItemRepairAssetsDevicesLayoutBinding binding) {
            super(binding.getRoot());
            this.binding = binding;
        }
    }
}

